Skip to content

fix(cli): resolve tsconfig aliases in database seeds - #919

Merged
Brooooooklyn merged 13 commits into
mainfrom
fix/db-seed-tsconfig-paths
Nov 25, 2026
Merged

Brooooooklyn merged 13 commits into
mainfrom
fix/db-seed-tsconfig-paths

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

void db seed now resolves the path aliases in the app's tsconfig.json (such as @schema and @auth-schema) in seed files and schema modules, including dynamic import(). Closes #872.

This continues #873 by @karthickeyan-dev, which was closed with its branch deleted. Their commits are kept as they were.

How it works

seed / schema import
├─ Node with tsconfig paths or baseUrl
│   └─ node:module registerHooks
│       ├─ aliases: app modules only (not node_modules or other packages)
│       ├─ .d.ts targets skipped, so `void/routes` keeps its runtime code
│       ├─ .ts/.tsx/.mts/.cts compiled with esbuild
│       └─ keeps jiti's leniency: extensionless paths, `lodash/range`,
│          named JSON imports, require/__dirname in promoted .js
└─ no paths, or Bun (no registerHooks) → jiti, as before

A missing .void/tsconfig.json stops the seed before the reset and says to run void prepare.

Known limits

  • CommonJS named imports use Node's export detection. A package whose names Node cannot see needs a default import.
  • export { SomeType } from './types' without type fails to link. TypeScript's isolatedModules reports the same thing.

Verification

🤖 Generated with Claude Code

karthickeyan-dev and others added 13 commits November 18, 2026 10:38
# Conflicts:
#	packages/void/src/cli/db.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fall back to jiti when node:module has no registerHooks (Bun), resolve
extensionless subpaths into packages without exports, load .tsx helpers,
and skip .json files for path targets as TypeScript does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
App modules get named exports from JSON files and CommonJS modules,
ESM-syntax JavaScript in a CommonJS app keeps require and __dirname, and
extensionless absolute paths resolve as relative ones do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Running a CommonJS module inside the load hook changed evaluation order,
could hit Node's require(esm) race guard, and changed what packages in
node_modules received. CommonJS imports keep Node's export detection.
JSON named exports now skip a byte order mark, __proto__, and malformed
keys, and Windows drive paths get the extension fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A JSON file that app code imports uses the value require() caches, so
both share one object, and every module in the seed graph gets the
extension lookup jiti gave it. Aliases still apply only to app modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T08:06:06.618692Z 81a4e33 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-db-seed-tsconfig-paths-void-cloud.voidzero-docs.workers.dev (commit 81a4e33)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://50647394-void-cloud.voidzero-docs.workers.dev 81a4e33 2026-11-25T08:05:13.856Z Visit the dashboard ↗

@Brooooooklyn
Brooooooklyn merged commit a3c4721 into main Nov 25, 2026
21 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/db-seed-tsconfig-paths branch November 25, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

void db seed cannot resolve @auth-schema imports in database schemas

3 participants